axios.defaults.baseURL = 'http://www.liulongbin.top:3007'
  

axios.interceptors.request.use(function (config) {
    if (config.url.indexOf('/my') !== -1) {
        config.headers['Authrizatio'] = localStorage.getItem('token')
    }
    //修改完毕的config需要返回
    return config
},function (error) {
    return Promise.rejeck(error)
})

//响应拦截器
axios.interceptors.response.use(function (response) {
    if (response.data.message === '身份认证失败') {
        //跳转,销毁toktn
        location.href = '/login.html'
        localStorage.removeItem('token')
    }
    //返回response
    return response
},function (error) {
    return Promise.rejeck(error)
})